package com.meitianhui.convenitenbuy.module.wallet.ui.activity;

import android.os.Bundle;
import android.widget.TextView;

import com.meitianhui.convenitenbuy.Constants;
import com.meitianhui.convenitenbuy.R;
import com.meitianhui.convenitenbuy.base.BaseToolbarActivity;
import com.meitianhui.convenitenbuy.module.wallet.model.RedPacketBean;

public class WalletRedPacketActivity extends BaseToolbarActivity {
    private RedPacketBean mBean;
    private TextView mTvValue;
    private TextView mTvUnit;
    private TextView mTvTip;

    @Override
    protected void initView(Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        setTbTitle(getString(R.string.wallet_wallet_red_packet));
        mBean = getIntent().getParcelableExtra(Constants.ARGUMENT);
        initId();
        initInfo();
        isEnable(false);
    }

    private void initInfo() {
        if (mBean != null) {
            String type = mBean.getGift_type();
            if (type.equals("gold")) {
                mTvTip.setText(getString(R.string.wallet_packet_tip_gold));
                mTvUnit.setText(getString(R.string.wallet_gold_coins));
                setTbTitle(getString(R.string.wallet_wallet_red_packet));
            } else if (type.equals("cash")) {
                mTvTip.setText(getString(R.string.wallet_packet_tip_change));
                mTvUnit.setText(getString(R.string.wallet_packet_unit_change));
                setTbTitle(getString(R.string.wallet_wallet_red_packet));
            } else if (type.equals("face_gift")) {
                mTvTip.setText(getString(R.string.wallet_packet_tip_gift));
                mTvUnit.setText(getString(R.string.wallet_packet_unit_change));
                setTbTitle(getString(R.string.wallet_packets_gift));
            }
            mTvValue.setText(mBean.getGift_value());
        }
    }

    private void initId() {
        mTvValue = getViewById(R.id.tv_wallet_packet_value);
        mTvUnit = getViewById(R.id.tv_wallet_packet_unit);
        mTvTip = getViewById(R.id.tv_wallet_packet_tip);
    }


    @Override
    protected void onRefreshData() {
        initInfo();
    }


    @Override
    protected int setView() {
        return R.layout.activity_wallet_red_packet;
    }

}
